﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Controls="clr-namespace:BillsManager.Views.Controls">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Values.xaml" />
        <ResourceDictionary Source="ErrorTemplate.xaml" />
        <ResourceDictionary Source="ContextMenuStyle.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="{x:Type TextBoxBase}" TargetType="{x:Type TextBoxBase}">

        <Setter Property="Background" Value="{StaticResource TextBox.Background.Normal}" />
        <Setter Property="BorderBrush" Value="{StaticResource TextBox.BorderBrush.Normal}" />
        <Setter Property="Foreground" Value="{StaticResource TextBox.Foreground.Normal}" />
        <Setter Property="BorderThickness" Value="{StaticResource View.Border.Thickness}" />

        <Setter Property="Padding" Value="1" />
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="AllowDrop" Value="true" />
        <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="False" />

        <Setter Property="ContextMenu">
            <Setter.Value>
                <ContextMenu>
                    <MenuItem Command="ApplicationCommands.Copy">
                        <MenuItem.Icon>
                            <Controls:AutoGreyableImage Source="/BillsManager.Views;component\Images/generic/copy-16.png" />
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem Command="ApplicationCommands.Cut">
                        <MenuItem.Icon>
                            <Controls:AutoGreyableImage Source="/BillsManager.Views;component\Images/generic/cut-16.png" />
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem Command="ApplicationCommands.Paste">
                        <MenuItem.Icon>
                            <Controls:AutoGreyableImage Source="/BillsManager.Views;component\Images/generic/paste-16.png" />
                        </MenuItem.Icon>
                    </MenuItem>
                </ContextMenu>
            </Setter.Value>
        </Setter>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBoxBase}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="{StaticResource Control.Border.CornerRadius}"
                            Padding="{TemplateBinding Padding}">
                        <ScrollViewer x:Name="PART_ContentHost" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>

            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Background" Value="{StaticResource TextBox.Background.Disabled}" />
                <Setter Property="BorderBrush" Value="{StaticResource TextBox.BorderBrush.Disabled}" />
                <Setter Property="Foreground" Value="{StaticResource TextBox.Foreground.Disabled}" />
            </Trigger>

        </Style.Triggers>

    </Style>

    <Style BasedOn="{StaticResource {x:Type TextBoxBase}}" TargetType="{x:Type TextBox}">
        <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ErrorTemplate}" />
    </Style>

</ResourceDictionary>